package publics.model;

import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="application")
public class Application {//企业贷款申请表
	
	 private Integer id;//ID   int not null
     private Enterprise ent;
     private LoanType loanType;//贷款种类        int not null
//	 private Integer loanType;//贷款种类        int not null
	 private Integer loanAmount;//贷款金额（元）      int not null
	 private String loanPurpose;//贷款用途     varchar(40) not null
	 private Integer loanPeriod;// 贷款期限（月）     int not null
	 private String repayPlan;//还款计划      varchar(100) not null
	 private String repayWay;//还款来源（途径）       varchar(100) not null
	 
	 private GuaranteeWay guaranteeWay;//担保方式    int not null,

//	 private Integer guaranteeWay;//担保方式    int not null,
	 private Boolean guaranteeInfo;//担保人所需材料是否齐全   bool not null


	 
//一下为以前的审核表字段，审核用	 
	 private Integer state;   //审核状态，1 2 3 4 5分别对应 待初审、待复审、待终审、已通过审核、未通过审核、

	private Float rate;//风险系数 float
	private String describe;//风险描述和备注 text
	
	private Boolean firstResult;//初审结果 bool,      注意在结果 是  拒绝的时候 应相应更改 state 字段 减少以后查询麻烦
	private String firstComments;//初审意见 varchar(100),
	private String firstApprover;//初审审批人 varchar(4),
	private String firstNum;//初审审批人工号     varchar(20),
	private Date   firstTime; //初审时间 datetime
	
	private Boolean secondResult;//复审结果 bool,
	private String secondComments;//复审意见 varchar(100),
	private String secondApprover;//复审审批人 varchar(4),
	private String secondNum;//复审审批人工号    varchar(20),
	private Date secondTime; //复审时间 datetime
	
	private Boolean finalResult;//最终审核结果 bool,
	private String finalComments;//最终审核意见 varchar(100),
	private String finalApprove;//终审审批人 varchar(4),
	private String finalNum;//终审审批人工号     varchar(20),
	private Date finalTime;//终审时间datetime
	 
	 
	 
	
	@Id
	@GeneratedValue
	@Column(name="App_id")
	 public Integer getId() {
		return id;
	}
	@ManyToOne
	@JoinColumn(name="Ent_id",nullable=false)
	public Enterprise getEnt() {
		return ent;
	}
/*	@OneToOne(mappedBy = "app",fetch=FetchType.LAZY)
	//@JoinColumn(name="App_che_id",nullable=false)
	public ApplicationCheck getApplicationCheck() {
		return applicationCheck;
	}*/

	@ManyToOne
    @JoinColumn(name="App_loan_type",nullable=false)
	public LoanType getLoanType() {
		return loanType;
	}
	
	/*@Column(name="App_loan_type")
	public Integer getLoanType() {
		return loanType;
	}*/
	@Column(name="App_loan_amount")
	public Integer getLoanAmount() {
		return loanAmount;
	}
	@Column(name="App_loan_purpose")
	public String getLoanPurpose() {
		return loanPurpose;
	}
	@Column(name="App_loan_period")
	public Integer getLoanPeriod() {
		return loanPeriod;
	}
	@Column(name="App_repay_plan")
	public String getRepayPlan() {
		return repayPlan;
	}
	@Column(name="App_repay_way")
	public String getRepayWay() {
		return repayWay;
	}
	/*@Column(name="App_guarantee_way")
	public Integer getGuaranteeWay() {
		return guaranteeWay;
	}*/
	@ManyToOne
    @JoinColumn(name="App_guarantee_way",nullable=false)
	public GuaranteeWay getGuaranteeWay() {
		return guaranteeWay;
	}
	@Column(name="App_guarantee_info")
	public Boolean isGuaranteeInfo() {
		return guaranteeInfo;
	}
	@Column(name="App_che_state")
	public Integer getState() {
		return state;
	}
	@Column(name="App_che_rate")
	public Float getRate() {
		return rate;
	}@Column(name="App_che_describe")
	public String getDescribe() {
		return describe;
	}
	@Column(name="App_che_first_result")
	public Boolean isFirstResult() {
		return firstResult;
	}
	@Column(name="App_che_first_comments")
	public String getFirstComments() {
		return firstComments;
	}
	@Column(name="App_che_first_approver")
	public String getFirstApprover() {
		return firstApprover;
	}
	@Column(name="App_che_first_num")
	public String getFirstNum() {
		return firstNum;
	}
	@Column(name="App_che_first_time")
	public Date getFirstTime() {
		return firstTime;
	}
	@Column(name="App_che_second_result")
	public Boolean isSecondResult() {
		return secondResult;
	}
	@Column(name="App_che_second_comments")
	public String getSecondComments() {
		return secondComments;
	}
	@Column(name="App_che_second_approver")
	public String getSecondApprover() {
		return secondApprover;
	}
	@Column(name="App_che_second_num")
	public String getSecondNum() {
		return secondNum;
	}	
	@Column(name="App_che_second_time")
	public Date getSecondTime() {
		return secondTime;
	}
	@Column(name="App_che_final_result")
	public Boolean isFinalResult() {
		return finalResult;
	}
	@Column(name="App_che_final_comments")
	public String getFinalComments() {
		return finalComments;
	}
	@Column(name="App_che_final_approver")
	public String getFinalApprove() {
		return finalApprove;
	}
	@Column(name="App_che_final_num")
	public String getFinalNum() {
		return finalNum;
	}
	@Column(name="App_che_final_time")
	public Date getFinalTime() {
		return finalTime;
	}
	
	
	
	
	
	
	
	
	public void setId(Integer id) {
		this.id = id;
	}
	public void setEnt(Enterprise ent) {
		this.ent = ent;
	}

	public void setLoanType(LoanType loanType) {
		this.loanType = loanType;
	}
	
/*	public void setApplicationCheck(ApplicationCheck applicationCheck) {
		this.applicationCheck = applicationCheck;
	}*/
	/*public void setLoanType(Integer loanType) {
		this.loanType = loanType;
	}*/
	public void setLoanAmount(Integer loanAmount) {
		this.loanAmount = loanAmount;
	}
	public void setLoanPurpose(String loanPurpose) {
		this.loanPurpose = loanPurpose;
	}
	public void setLoanPeriod(Integer loanPeriod) {
		this.loanPeriod = loanPeriod;
	}
	public void setRepayPlan(String repayPlan) {
		this.repayPlan = repayPlan;
	}
	public void setRepayWay(String repayWay) {
		this.repayWay = repayWay;
	}
	/*public void setGuaranteeWay(Integer guaranteeWay) {
		this.guaranteeWay = guaranteeWay;
	}*/
	public void setGuaranteeWay(GuaranteeWay guaranteeWay) {
		this.guaranteeWay = guaranteeWay;
	}
	public void setGuaranteeInfo(Boolean guaranteeInfo) {
		this.guaranteeInfo = guaranteeInfo;
	}
	public void setState(Integer state) {
		this.state = state;
	}
	public void setRate(Float rate) {
		this.rate = rate;
	}
	public void setDescribe(String describe) {
		this.describe = describe;
	}
	public void setFirstResult(Boolean firstResult) {
		this.firstResult = firstResult;
	}
	public void setFirstComments(String firstComments) {
		this.firstComments = firstComments;
	}
	public void setFirstApprover(String firstApprover) {
		this.firstApprover = firstApprover;
	}
	public void setFirstNum(String firstNum) {
		this.firstNum = firstNum;
	}
	public void setFirstTime(Date firstTime) {
		this.firstTime = firstTime;
	}
	public void setSecondResult(Boolean secondResult) {
		this.secondResult = secondResult;
	}
	public void setSecondComments(String secondComments) {
		this.secondComments = secondComments;
	}
	public void setSecondApprover(String secondApprover) {
		this.secondApprover = secondApprover;
	}
	public void setSecondNum(String secondNum) {
		this.secondNum = secondNum;
	}
	public void setSecondTime(Date secondTime) {
		this.secondTime = secondTime;
	}
	public void setFinalResult(Boolean finalResult) {
		this.finalResult = finalResult;
	}
	public void setFinalComments(String finalComments) {
		this.finalComments = finalComments;
	}
	public void setFinalApprove(String finalApprove) {
		this.finalApprove = finalApprove;
	}
	public void setFinalNum(String finalNum) {
		this.finalNum = finalNum;
	}
	public void setFinalTime(Date finalTime) {
		this.finalTime = finalTime;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Application [describe=" + describe + ", ent=" + ent
				+ ", finalApprove=" + finalApprove + ", finalComments="
				+ finalComments + ", finalNum=" + finalNum + ", finalResult="
				+ finalResult + ", finalTime=" + finalTime + ", firstApprover="
				+ firstApprover + ", firstComments=" + firstComments
				+ ", firstNum=" + firstNum + ", firstResult=" + firstResult
				+ ", firstTime=" + firstTime + ", guaranteeInfo="
				+ guaranteeInfo + ", guaranteeWay=" + guaranteeWay + ", id="
				+ id + ", loanAmount=" + loanAmount + ", loanPeriod="
				+ loanPeriod + ", loanPurpose=" + loanPurpose + ", loanType="
				+ loanType + ", rate=" + rate + ", repayPlan=" + repayPlan
				+ ", repayWay=" + repayWay + ", secondApprover="
				+ secondApprover + ", secondComments=" + secondComments
				+ ", secondNum=" + secondNum + ", secondResult=" + secondResult
				+ ", secondTime=" + secondTime + ", state=" + state + "]";
	}
	  
	
    
	
}
